<template>
  <div class="jl_input">
    <div class="jl_input_item pr10 bor_bottom">
      <span class="w04" :style="'color:' + color">
        <em class="font_red" v-if="required">*</em>
        {{label}}
      </span>
      <input class="w08 tr" :type="type" v-model="v" :placeholder="placeholder" :disabled="disabled"/>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'jl-from-input',
    props: {
      label: { type: String },
      value: {},
      required: {
        type: Boolean,
        default: false
      },
      disabled: {
        type: Boolean
      },
      placeholder: {
        type: String,
        default: ''
      },
      type: { type: String, default: 'text' },
      color:{ type: String, default: 'gray' },
    },
    data() {
      return {
        v: undefined,
      }
    },
    watch: {
      v(n) {
        this.$emit('input', n)
      },
      value: {
        handler(val, oldVal) {
          this.v = val
        },
        immediate: true
      }
    }
  }
</script>

<style scoped>
</style>
